//package com.quark.common.security.handler;
//
//import cn.hutool.core.util.CharsetUtil;
//import cn.hutool.http.HttpUtil;
//import com.quark.util.WebUtils;
//import lombok.SneakyThrows;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.authentication.AuthenticationFailureHandler;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @author 张高昌
// * @date 2021/12/10 9:36
// * @description: 功能描述
// */
//@Slf4j
//public class FormAuthenticationFailureHandler implements AuthenticationFailureHandler {
//
//    @Override
//    @SneakyThrows
//    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
//                                        AuthenticationException exception) {
//        log.debug("表单登录失败:{}", exception.getLocalizedMessage());
//        String url = HttpUtil.encodeParams(String.format("/token/login?error=%s", exception.getMessage()),
//                CharsetUtil.CHARSET_UTF_8);
//        WebUtils.getResponse().sendRedirect(url);
//    }
//}
